#include<stdio.h>
#include<math.h>
int main()
{
    double pi = 0.0 ,n = 1.0 , term = 1.0;
    int sign = 1;

    while(fabs(term)>1e-8)
    {
        pi = pi + term;
        n = n + 2;
        sign = -sign;
        term = sign/n;

    }
    pi = pi * 4;
    printf("pi = %10.8f",pi);
    return 0;
}